package VN.EDU.IMIC.DEVELOPER.DOTHANHTUNG.ARRAY;

public class model {
	
	public int TinhTong(int[] mylist){
		int result=0;
		for (int i=0; i < mylist.length; i++){
			 result = result + mylist[i];
		}
		return result;
	}
	
	public int findMax(int[] mylist){
		int max = 0;
		for (int i=0; i < mylist.length; i++){
			if (max < mylist[i]){
				 max = mylist[i];
			}
		}
		return max;
	}
	
	public int findPositionMax(int[] mylist){
		int max = 0;
		int positionMax = 0;
		for (int i=0; i < mylist.length; i++){
			if (max < mylist[i]){
				 max = mylist[i];
				 positionMax = i;
			}
		}
		return positionMax;
	}
	public int findPositionMin(int[] mylist){
		int min = 0;
		int positionMin = 0;
		for (int i=0; i < mylist.length; i++){
			if (min > mylist[i]){
				min = mylist[i];
				positionMin = i;
			}
		}
		return positionMin;
	}
}
